#include<iostream>
#include<string>
#include<vector>
using namespace std;
class Solution {
public:
    string longestCommonPrefix(vector<string>& strs) {
        string prefix;
        for (int i = 0; i < strs[0].size(); i++)
        {
            for (auto e : strs)
            {
                if (e.find(prefix + strs[0][i]) != 0)
                {
                    return prefix;
                }
            }
            prefix += strs[0][i];
        }
        return prefix;
    }
};